{layout name="layout" /}
<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">菜单添加</div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-sm-8">
                        <form action="{:url('admin/user/edit',['id'=>$userRow['id']])}" class="form-horizontal ajax-form" method="post" name="user">
                            <div class="form-group">
                                <label for="inputrole_id" class="col-sm-3 control-label">用户组</label>
                                <div class="col-sm-5">
                                    <select name="role_id" id="inputrole_id" class="form-control">
                                        <option value="0">请选择用户组</option>
                                        {volist name="roleRows" id="vo"}
                                        {if condition="$vo['id'] eq $userRow['role_id']"}
                                        <option value="{$vo.id}" selected="selected">{$vo.name}</option>
                                        {else /}
                                        <option value="{$vo.id}">{$vo.name}</option>
                                        {/if}
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputemail" class="col-sm-3 control-label">用户邮件地址</label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" disabled="disabled" name="email" id="inputemail" value="{$userRow.email}" placeholder="用户邮件地址"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputname" class="col-sm-3 control-label">用户姓名</label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" name="name" id="inputname" value="{$userRow.name}" placeholder="用户姓名">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="inputpassword" class="col-sm-3 control-label">用户密码</label>
                                <div class="col-sm-5">
                                    <input type="password" class="form-control" name="password" id="inputpassword" placeholder="用户密码">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="inputrepassword" class="col-sm-3 control-label">确认密码</label>
                                <div class="col-sm-5">
                                    <input type="password" class="form-control" name="repassword" id="inputrepassword" placeholder="确认密码">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="" class="col-sm-3 control-label">头像</label>
                                <div class="col-sm-5">                                    
                                    <img src="{$userRow.head|default=$default_image}" style="max-width:100px; max-height:100px;" id="head" class="img-circle upload">
                                    <input type="hidden" name="head" value="{$userRow.head}" />
                                </div>
                            </div>

                             <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputstatus"> 是否启用 </label>
                                <div class="col-sm-5">
                                    {if condition="$userRow['status'] eq 1"}
                                    <input type="checkbox" name="status" id="inputstatus" value="1" checked="checked" />
                                    {else /}
                                    <input type="checkbox" name="status" id="inputstatus" value="1" />
                                    {/if}
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputsex"> 性别 </label>
                                <div class="col-sm-5">
                                {if condition="$userRow['sex'] eq 0"}
                                    <input type="radio" name="sex" id="inputsex" value="0" checked="checked" />
                                {else /}
                                    <input type="radio" name="sex" id="inputsex" value="0" />
                                {/if}
                                    保密
                                {if condition="$userRow['sex'] eq 1"}
                                    <input type="radio" name="sex" id="inputsex" value="1" checked="checked" />
                                {else /}
                                    <input type="radio" name="sex" id="inputsex" value="1" />
                                {/if}
                                    男
                                {if condition="$userRow['sex'] eq 2"}
                                    <input type="radio" name="sex" id="inputsex" value="2" checked="checked" />
                                {else /}
                                    <input type="radio" name="sex" id="inputsex" value="2" />
                                {/if}
                                    女
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputtel"> 联系号码 </label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" name="tel" value="{$userRow.tel}" id="inputtel" placeholder="联系号码">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="inputbirthday" class="col-sm-3 control-label">生日</label>
                                <div class="col-sm-5">
                                    <div class="widget-group">
                                        <input type="text" class="form-control date" value="{$userRow.birthday}" name="birthday" id="inputbirthday" placeholder="生日">
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-offset-3 col-sm-9">
                                    <button type="submit" class="btn btn-primary">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
$(function(argument) {
$('form.ajax-form').formLuffyZhao([{
        name: "name",
        display: '用户姓名',
        rules: 'required|ruleNameRegex'
    },{
        name: "repassword",
        display: '确认密码',
        rules: 'matches[password]'
    },{
        name: "password",
        display: '密码',
        rules: 'min_length[6]|max_length[20]'
    },{
        name:"birthday",
        display:"生日",
        rules:"date"
    },{
        name:"tel",
        display:"联系号码",
        rules:"tel_or_mobile"
    }
    ]);
});
</script>
